/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
package com.genia.toolbox.web.gwt.form.client.widget.item.impl;

import com.genia.toolbox.web.gwt.form.client.CssNames;
import com.genia.toolbox.web.gwt.form.client.form.TextBoxItem;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.TextBoxBase;

/**
 * the implementation of <code>SimpleItemWidget</code> for a
 * <code>TextBoxItem</code>.
 */
public class TextBoxItemWidget
    extends AbstractTextBoxBaseItemWidget<TextBoxItem>
{
  /**
   * the <code>TextBox</code> being displayed.
   */
  private transient TextBox textBox = null;



  /**
   * constructor.
   * 
   * @param item
   *          the item this object represents.
   */
  public TextBoxItemWidget(final TextBoxItem item)
  {
    super(item);
  }



  /**
   * returns the CSS name of this widget.
   * 
   * @return the CSS name of this widget
   */
  @Override
  protected String getCssName()
  {
    return CssNames.TEXT_BOX_PANEL_CSS_STYLE;
  }



  /**
   * returns the TextBoxBase encapsulated in this SimpleItemWidget.
   * 
   * @return the TextBoxBase encapsulated in this SimpleItemWidget
   */
  @Override
  protected TextBoxBase getTextBoxBase()
  {
    if (textBox == null) {
      textBox = new TextBox();
    }
    return textBox;
  }
}
